package com.cleaningcloud.cld.controller;

import com.cleaningcloud.cld.domain.CldAssets;
import com.cleaningcloud.cld.domain.dto.AssetsStatisticsDto;
import com.cleaningcloud.cld.service.IAssetsStatisticsService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/assetsStatistics")
public class AssetsStatisticsController extends BaseController {

    @Autowired
    private IAssetsStatisticsService assetsStatisticsService;

    /**
     * 资产头部统计
     * @param assetsStatisticsDto
     * @return
     */
    @GetMapping("/assetHeadStatistics")
    public AjaxResult assetHeadStatistics(AssetsStatisticsDto assetsStatisticsDto){
        return success(assetsStatisticsService.assetHeadStatistics(assetsStatisticsDto));
    }

    /**
     * 资产合计统计
     * @param assetsStatisticsDto
     * @return
     */
    @GetMapping("/totalAssetsStatistics")
    public TableDataInfo totalAssetsStatistics(AssetsStatisticsDto assetsStatisticsDto){
        startPage();
        List<Map<String,Object>> list = assetsStatisticsService.totalAssetsStatistics(assetsStatisticsDto);
        return getDataTable(list);
    }

    /**
     * 资产合计 - 资产明细
     * @param assetsStatisticsDto
     * @return
     */
    @GetMapping("/selectAssetsDetailsList")
    public AjaxResult selectAssetsDetailsList(AssetsStatisticsDto assetsStatisticsDto){
        return success(assetsStatisticsService.selectAssetsDetailsList(assetsStatisticsDto));
    }

    /**
     * 资产明细 项目分组
     * @param assetsStatisticsDto
     * @return
     */
    @GetMapping("/selectAssetsDetailsGroupProject")
    public AjaxResult selectAssetsDetailsGroupProject(AssetsStatisticsDto assetsStatisticsDto){
        return success(assetsStatisticsService.selectAssetsDetailsGroupProject(assetsStatisticsDto));
    }

    /**
     * 资产明细
     * @param assetsStatisticsDto
     * @return
     */
    @GetMapping("/selectCldAssetsDetailsList")
    public TableDataInfo selectCldAssetsDetailsList(AssetsStatisticsDto assetsStatisticsDto){
        startPage();
        List<Map<String,Object>> list = assetsStatisticsService.selectCldAssetsDetailsList(assetsStatisticsDto);
        return getDataTable(list);
    }
}
